package DianShang_2024.ds_01.extract

import org.apache.spark.sql.SparkSession

object test {

  //  config("spark.sql.warehouse.dir", "hdfs://162.168.40.110/user/hive/warehouse/")
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .master("local[*]")
      .config("spark.sql.warehouse.dir", "hdfs://162.168.40.110/user/hive/warehouse/")
      .appName("准备表格和数据")
      .enableHiveSupport()
      .getOrCreate()

//    spark.sql("create database test_database02").show
//    spark.sql("show databases").show
//    spark.sql("DESCRIBE DATABASE EXTENDED test_database02").show
//    spark.sql(
//      """
//        |create table test_database02.student(
//        |id int,
//        |name string
//        |)
//        |""".stripMargin)

    spark.sql(
      """
        |insert into test_database02.student
        |values(3,"学生3")
        |""".stripMargin).show

    spark.sql(
      """
        |select * from test_database02.student
        |""".stripMargin).show




    spark.close()
  }

}
